import unittest
from testcase import demotestcase1, demotestcase2

# 创建一个加载器对象    加载测试类
loader = unittest.TestLoader()
loader1 = loader.loadTestsFromTestCase(demotestcase1.DemoTestCase1)
loader2 = loader.loadTestsFromTestCase(demotestcase2.DemoTestCase2)

# 创建一个测试套件    收集测试类
suite = unittest.TestSuite()
suite.addTest(loader1)
suite.addTest(loader2)

# 创建执行器     执行测试类
runner = unittest.TextTestRunner()
runner.run(suite)